#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<queue>

using namespace std;
int n;
struct data{
	int s,ii;
}a[200000+5];
int check(){
	int sum=0;
	for(int qwq=1;qwq<=n;qwq++)if(a[qwq].s!=-1)sum++;
	return sum;
}
void maintain(){
	data b[200000+5];
	int b_n=0;
	for(int qwq=1;qwq<=n;qwq++)if(a[qwq].s!=-1)b[++b_n]=a[qwq];
	n=b_n;
	for(int qwq=1;qwq<=n;qwq++)a[qwq]=b[qwq];
	return;
}
void work(){
	maintain();
	int tmp=1;
	a[n+1].s=666;
	for(int i=1;i<=n;i++){
		if(a[i].s!=a[i+1].s){
			printf("%d ",a[tmp].ii);
			a[tmp].s=-1;
			tmp=i+1;
		}
	}
	printf("\n");
	return;
}
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i].s);
		a[i].ii=i;
	}
	while(1){
		int num;
		num=check();
		if(num==0)return 0;
		work();
	}
	return 0;
}

